package com.my.study.common;

import com.my.study.springframework.bean.BeansException;
import com.my.study.springframework.bean.PropertyValue;
import com.my.study.springframework.bean.PropertyValues;
import com.my.study.springframework.bean.factory.ConfigurableListableBeanFactory;
import com.my.study.springframework.bean.factory.config.BeanDefinition;
import com.my.study.springframework.bean.factory.config.BeanFactoryPostProcessor;

/**
 * @author: yidujun
 * @create: 2021/07/07 16:04
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition userService1 = beanFactory.getBeanDefinition("userService1");
        PropertyValues propertyValues = userService1.getPropertyValues();

        propertyValues.addPropertyValue(new PropertyValue("company", "改为：字节跳动"));
    }
}
